package com.anycl.design.j2ee.dataaccessobject;

import java.util.ArrayList;
import java.util.List;

public class UserDaoImpl implements UserDao {
    private List<User> users = new ArrayList<>();

    @Override
    public User addUser(User user) {
        users.add(user);
        return user;
    }

    @Override
    public User getUserById(Integer id) {
        return users.stream().filter(user -> user.getId().equals(id)).findFirst().get();
    }
}
